package com.company.cloud.user.modules.mgr.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.company.cloud.common.auth.bean.PermRoleInfo;
import com.company.cloud.user.modules.base.entity.PermissionInfo;

public interface UserRolePermissionMapper {
	
	
//	@Select("SELECT a.resource AS permUrl,a.code AS permCode,b.role_code AS roleCode "
//			+ "FROM pt_admin_permission_info a "
//			+ "INNER JOIN pt_admin_role_permission_info b ON (a.code=b.per_code) ${ew.customSqlSegment}")
//	public List<PermRoleInfo> queryPermRoleP(@Param(Constants.WRAPPER) Wrapper<PermRoleInfo> wrapper);

	@Select("select a.resource AS permUrl,a.code AS permCode, b.role_code AS roleCode "
			+ "FROM cust_permission_info a "
			+ "INNER JOIN cust_role_permission_info b ON (a.code=b.per_code) ${ew.customSqlSegment}")
	public List<PermRoleInfo> queryPermRoleForB(@Param(Constants.WRAPPER) Wrapper<PermRoleInfo> wrapper);
	
	@Select("SELECT c.code, c.type, c.name, c.show_name, c.icon, c.url,c.state, "
			+ "c.orders, c.show_platform, c.remark, c.resource, c.parent_code "
			+ "FROM cust_user_role_info a "
			+ "INNER JOIN cust_role_permission_info  b ON (a.role_code=b.role_code)"
			+ "INNER JOIN cust_permission_info c ON (b.per_code=c.code) ${ew.customSqlSegment}")
	public List<PermissionInfo> queryUserMenu(@Param(Constants.WRAPPER) Wrapper<PermissionInfo> wrapper);
	
}
